Page({
  data: {
    banners: [
      { id: 1, image: '/static/home-banner1.jpg' },
      { id: 2, image: '/static/home-banner2.jpg' },
      { id: 3, image: '/static/home-banner3.jpg' }
    ],
    quickEntries: [
      { id: 1, name: '新闻资讯', icon: '/static/entry-news.png' },
      { id: 2, name: '教育中心', icon: '/static/entry-edu.png' },
      { id: 3, name: '便民服务', icon: '/static/entry-service.png' },
      { id: 4, name: '政务公开', icon: '/static/entry-gov.png' },
      { id: 5, name: '生活缴费', icon: '/static/entry-payment.png' },
      { id: 6, name: '交通出行', icon: '/static/entry-transport.png' },
      { id: 7, name: '医疗健康', icon: '/static/entry-health.png' },
      { id: 8, name: '我的收藏', icon: '/static/entry-favorite.png' }
    ],
    newsList: [
      { id: 1, title: '南阳市召开2025年城市发展规划会议', time: '2025-06-15' },
      { id: 2, title: '南阳理工学院新增人工智能专业', time: '2025-06-10' },
      { id: 3, title: '南阳市民服务中心即将投入使用', time: '2025-06-05' }
    ],
    activities: [
      { id: 1, name: '端午节文化活动', time: '06/20-06/22', image: '/static/activity1.jpg' },
      { id: 2, name: '夏季招聘会', time: '06/25 09:00', image: '/static/activity2.jpg' },
      { id: 3, name: '社区义诊活动', time: '06/28 全天', image: '/static/activity3.jpg' }
    ]
  },

  onLoad() {
    // 这里可以添加从服务器获取数据的逻辑
  },

  navigateToSearch() {
    wx.navigateTo({
      url: '/pages/search/search'
    });
  },

  navigateToEntry(e) {
    const id = e.currentTarget.dataset.id;
    let url = '';
    switch(id) {
      case 1: url = '/pages/news/list'; break;
      case 2: url = '/pages/education/education'; break;
      case 8: url = '/pages/favorites/favorites'; break;
      default: url = '/pages/index/index';
    }
    wx.navigateTo({ url });
  },

  navigateToNewsList() {
    wx.navigateTo({
      url: '/pages/news/list'
    });
  },

  navigateToNewsDetail(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/news/detail/detail?id=${id}`
    });
  },

  navigateToActivity(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/activity/detail?id=${id}`
    });
  }
});
